const CryptoJS = require('crypto-js');
var DES3 = {
    iv: function() {
        return '20230729'
    },
    encrypt: function(b, c, a) {
        if (c) {
            return (CryptoJS.TripleDES.encrypt(b, CryptoJS.enc.Utf8.parse(c), {
                iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),
                mode: CryptoJS.mode.CBC,
                padding: CryptoJS.pad.Pkcs7
            })).toString()
        }
        return ""
    },
    decrypt: function(b, c, a) {
        if (c) {
            return CryptoJS.enc.Utf8.stringify(CryptoJS.TripleDES.decrypt(b, CryptoJS.enc.Utf8.parse(c), {
                iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),
                mode: CryptoJS.mode.CBC,
                padding: CryptoJS.pad.Pkcs7
            })).toString()
        }
        return ""
    }
};

var data = {
    "secretKey": "zYYlOfutVxVTEr8gGhDvCQlc",
    // "result": "dEbXpRZOSVpvUYeNsTTXmAv6XcC+Gknoel6prVrhBl/caPo7rN81BCxLxWcB9WGhp8DOXq27iSmrylZn3mF90g==",
    "result": "GUCnflQnyHXJMkytDuQ5rJTIPiC/XfZeaj535Ghu3kgGKRPyqWGpVFn5r5u76MraI7Yrxg0bMkuThkHgQSWuXw==",
};
var data2 = {
    "secretKey": "fScNXNpbQTTdyjKaHCZYcTGt",
    // "result": "dEbXpRZOSVpvUYeNsTTXmAv6XcC+Gknoel6prVrhBl/caPo7rN81BCxLxWcB9WGhp8DOXq27iSmrylZn3mF90g==",
    "result": "8PSuZwrWt9j8cuyAt3/IXnIzrxNKA7Dxir6UsbrlCDgRmn3VVPED57JsGSIeYEhQajWDhCfUiIs9ZGvM+pFG1BCfdYfhwYOMBhyafERHSajJB4FATQOMHTGIeaOw1uxGo39bUXc0GCyKsN2ctJirjVe8/UuA0ft8BkvJ/Pre30bUQzXAFtq+1GcqaN/m7R+2hVlxCAn4Ejn6KOcPlh2UAyMBVrHm1+6fsFd2G8MjlG3QCqzLYz2nuX8+SEmrrEM6Umsoi2xqyMHITai+V1XGGDp3JzDQtIcKWoNJXlpp+w4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zE6DYUdEjHJbqzop+N77iW0BJlYuMlMCm5JpdeesHEa4NJWUqpkFrWIt0+bZniPRQOEcUyYEu1BKGTaqcIvtquqw6iFcUSVLP9LkT9Ap0JDR4CvkwoRKpitutY/Awj62Ma2AEqL9j/d34mw1VON70rMsVb0tppu+Cy5GN1oSRBujdMmkR8HQV72/9pvz1+3vr3ovwKG7mxX/DgUlKK40MFX351dpCNZqTXRmFVRp9hUqHL4Rje8YsK8/VPIb/dQggDeB74NON3Xr1FooChzFC5M+cLr4OwGu7+OJhmzBDIugdWUmXu2GC/hhbhlQvcV+hZkAG2jepWWn1xIcrWQlTUERCfriGVapjfrJHDM05BwwwQq6WlL8lbUa7hRXtyW6jqViBY3OyDWHLKOD+y8I/wzp8jYLObNY6NH+QFiHocl6KdCLkt9qs7Y/zXJJKVzVTWaW2ORnAAd5hFz7HCQJc8aAluzxLoouwnxCVuw2ywmJgrsqJA7+rr/WbGDiQ2JtOTVNbxjVS0Sga7pdujltoXW0CexGnYDSN/ObLCAbu55X3ez2hrHxIS+vIEktsvDeW5gNX4qlr5w+e4fTwqsrLazLtBe8S+byRY/nimcIC9zifF99PY+6iYgp9hjbkyiR31bhZUhZTni36yWYV/"
    ,
};
console.log(DES3.iv());
var decryptStr = DES3.decrypt(data2.result, data2.secretKey);
console.log('解密结果： ', decryptStr);
var encryptStr = DES3.encrypt(decryptStr, data.secretKey);
//console.log(encryptStr);
